package com.chinasofti.IO;

import java.io.File;

public class Demo04 {
        public static void main(String[] args) {
            File srcFile = new File("E:\\Users\\apple\\desktop");
            deleteFolder(srcFile);
        }
        //递归方法
        public static void deleteFolder(File file){
            File[] file1 = file.listFiles();
            for (File file2 : file1){
                if (file2.isFile()){
                    file2.delete();
                }else {
                    deleteFolder(file2);
                }
            }
            file.delete();


        }


}
